<?php

// 后台登录控制器
class LoginController extends Controller{
	public function index(){
  
       $this->display();

	}



public function login(){

 if(IS_POST){  
        $username=$_POST['username'];
        $pwd=md5($_POST['pwd']);
       
      if(strtoupper($_POST['code']) != $_SESSION['code'])  $this->error('验证码错误');
       $rows = M('hd_admin')->query("SELECT * FROM hd_admin where username='$username'&&passwd='$pwd'");
        // p($rows);die;
        if($rows){
           $_SESSION['adminname']=$_POST['username'];
            $_SESSION['aid']=$rows[0]['aid'];
           
            
           $this->success('登录成功',__APP__.'?c=index'); 
        } else{ 
            $this->error('用户名或密码错误');
           } 

    }


}
// 验证码
public function code(){
  $code=new Code(100,30,1);
  $code->show();

	
}















}
?>